Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Give users a chance to Input the path of BuildTools\VC #31

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

cchangwen
Copy link

vswhere.exe return nothing If there is no complete installation of Visual Studio https://visualstudio.microsoft.com/visual-cpp-build-tools/

vswhere.exe return nothing If there is no complete installation of Visual Studio https://visualstudio.microsoft.com/visual-cpp-build-tools/
@cmb69
Copy link
Member

cmb69 commented Sep 21, 2024

That worked fine for me a couple of years ago (see https://gist.github.com/cmb69/47b8c7fb392f5d79b245c74ac496632c).

Is it possible that you have the build tools for vs 17 installed (plus the MSVC v142 tools), but want to build for vs16? This is supported if you call phpsdk-starter.bat -c vs16 -a x64 -s 14.29 (i.e. you explicitly pass the -s option).

@cmb69 cmb69 added the question Further information is requested label Sep 21, 2024
@cchangwen
Copy link
Author

@cmb69 Just as you said.

phpsdk-vs16-x64.bat
Could not determine 'vs16' directory
phpsdk-starter.bat -c vs16 -a x64 -s 14.2
[vcvarsall.bat] Environment initialized for: 'x64'

PHP SDK 2.3.0

OS architecture:    x64
Build architecture: x64
Visual C++:         14.29.30154.0
PHP-SDK path:       d:\php-sdk-binary-tools-php-sdk-2.3.0

@cchangwen
Copy link
Author

cchangwen commented Sep 21, 2024

In some cases, vswhere. exe don't output valid information, causing all scripts that depend on it to not work properly.
phpsdk_setshell.bat

@cmb69
Copy link
Member

cmb69 commented Sep 21, 2024

Yes, this is a known issue. That part of detection is super strict and uses a range, to avoid finding another Visual Studio installation; this is important if you have multiple versions of Visual Studio installed. See also #29.

While offering the possibility to input the path manually (i.e. this PR) is certainly an option, I prefer to apply a local patch for easy of use (I start the php-sdk environments usually quite often).

Patch
 phpsdk-vc15-x64.bat | 2 +-
 phpsdk-vc15-x86.bat | 2 +-
 phpsdk-vs16-x64.bat | 2 +-
 phpsdk-vs16-x86.bat | 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/phpsdk-vc15-x64.bat b/phpsdk-vc15-x64.bat
index 5988bdb..12247b3 100755
--- a/phpsdk-vc15-x64.bat
+++ b/phpsdk-vc15-x64.bat
@@ -1,6 +1,6 @@
 @echo off
 
-call %~dp0phpsdk-starter.bat -c vc15 -a x64 %*
+call %~dp0phpsdk-starter.bat -c vc15 -a x64 -s 14.16 %*
 
 exit /b %ERRORLEVEL%
 
diff --git a/phpsdk-vc15-x86.bat b/phpsdk-vc15-x86.bat
index 3721abe..468cbaf 100755
--- a/phpsdk-vc15-x86.bat
+++ b/phpsdk-vc15-x86.bat
@@ -1,6 +1,6 @@
 @echo off
 
-call %~dp0phpsdk-starter.bat -c vc15 -a x86 %*
+call %~dp0phpsdk-starter.bat -c vc15 -a x86 -s 14.16 %*
 
 exit /b %ERRORLEVEL%
 
diff --git a/phpsdk-vs16-x64.bat b/phpsdk-vs16-x64.bat
index c0c58e4..07a1652 100755
--- a/phpsdk-vs16-x64.bat
+++ b/phpsdk-vs16-x64.bat
@@ -1,6 +1,6 @@
 @echo off
 
-call %~dp0phpsdk-starter.bat -c vs16 -a x64 %*
+call %~dp0phpsdk-starter.bat -c vs16 -a x64 -s 14.29 %*
 
 exit /b %ERRORLEVEL%
 
diff --git a/phpsdk-vs16-x86.bat b/phpsdk-vs16-x86.bat
index 5162e0a..d6f07f6 100755
--- a/phpsdk-vs16-x86.bat
+++ b/phpsdk-vs16-x86.bat
@@ -1,6 +1,6 @@
 @echo off
 
-call %~dp0phpsdk-starter.bat -c vs16 -a x86 %*
+call %~dp0phpsdk-starter.bat -c vs16 -a x86 -s 14.29 %*
 
 exit /b %ERRORLEVEL%

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants